package com.itheima.servlet;

import com.itheima.dao.UserDao;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class BeanScope {

    /**
     * Bean的作用范围
     * @param args
     */
    public static void main(String[] args) {
        //
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("bean_annotation.xml");
        UserDao userDao1 = applicationContext.getBean("userDao", UserDao.class);
        UserDao userDao2 = applicationContext.getBean("userDao", UserDao.class);
        System.out.println(userDao1 == userDao2);
    }
}
